
Partial Class GTSWeb_UpdateProfile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not (Page.IsPostBack) Then
            Dim User As MembershipUser = Membership.GetUser
            txtFirstName.Text = Profile.FirstName
            txtLastName.Text = Profile.LastName
            txtEmail.Text = User.Email
        End If
        lblMessage.Text = ""

    End Sub

    Protected Sub btnUpdateProfile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateProfile.Click
        Try
            Dim User As MembershipUser = Membership.GetUser
            Dim p As ProfileCommon = ProfileCommon.Create(Membership.GetUser.ToString, True)
            p.FirstName = txtFirstName.Text
            p.LastName = txtLastName.Text
            User.Email = txtEmail.Text
            p.RateLocationID = ddlRateLocation.SelectedValue
            Membership.UpdateUser(User)
            p.Save()

            lblMessage.Text = "Your profile has been successfully updated"

        Catch ex As Exception
            lblMessage.Text = "System Error <br/>" + ex.Message.ToString
        End Try
     
    End Sub
End Class
